package cn.shop.utils;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author : 李一涵
 * @date : Created in 2021-10-29 9:33
 * @description: api返回结果代码
 */
public enum ApiCode {

	FAIL(0, "操作失败"),
	SUCCESS(1, "操作成功"),
	SUCCESS_SEND_FAIL(9, "操作成功，通讯失败"),
	PARAMETER_ERROR(2, "参数错误"),
	UNKNOWN_ERROR(3, "未知错误"),
	NO_LOGIN(4, "未登录"),
	NOT_FIND(5, "未找到"),
	NOT_PERMISSION(6, "无权限访问"),
	NOT_ROLE(7, "当前账号无权限访问"),
	NOT_USER(8, "无此用户"),
	NOT_REAL_NAME(11, "请先进行实名认证"),
	NOT_FOUND(404, "页面不存在"),

	VALIDATE_SIGNATURE_ERROR(-40001, "签名验证错误"),
	COMPUTE_SIGNATURE_ERROR(-40003, "sha加密生成签名失败");

	@JsonValue
	private final int code;

	private final String description;

	ApiCode(int code, String description) {
		this.code = code;
		this.description = description;
	}

	public int code() {
		return code;
	}

	public String description() {
		return description;
	}
}
